<template>
  <div class="rights">
    <div class="rights_header">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>权限管理</el-breadcrumb-item>
        <el-breadcrumb-item>权限列表</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="rights_list_box">
      <div class="rights_list_box_box">
        <div class="rights_list_box_body">
          <el-table :data="Rightsdata" border style="width: 100%">
            <el-table-column label="#" prop="index" width="48">
              <template slot-scope="scope">
                {{ scope.$index + 1 }}
              </template>
            </el-table-column>
            <el-table-column prop="authName" label="权限名称" width="400">
            </el-table-column>
            <el-table-column prop="path" label="路径" width="400">
            </el-table-column>
            <el-table-column prop="level" label="权限等级">
              <template slot-scope="scope">
                <el-tag
                  :type="
                    scope.row.level == 0
                      ? 'success'
                      : scope.row.level == 1
                      ? 'info'
                      : 'warning'
                  "
                  disable-transitions
                  >{{
                    scope.row.level == 0
                      ? "一级"
                      : scope.row.level == 1
                      ? "二级"
                      : "三级"
                  }}</el-tag
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getRights } from "@/api/power.js";
export default {
  data() {
    return {
      Rightsdata: [],
    };
  },
  mounted() {
    this.getRightsdata();
  },
  methods: {
    getRightsdata() {
      getRights().then((res) => {
        console.log(res);
        this.Rightsdata = res.data;
        this.$message({
          type: "success",
          message: res.meta.msg,
        });
      });
    },
  },
  components: {},
};
</script>

<style lang='scss' scoped>
.rights {
  width: 100%;
  height: 100%;
  background: #eee;
  .rights_header {
    width: 100%;
    height: 80px;
    padding-top: 30px;
    padding-left: 30px;
  }
  .rights_list_box {
    width: 100%;
    height: calc(100% - 80px);
    .rights_list_box_box {
      width: 95%;
      height: 100%;
      background: #fff;
      margin: 0 auto;

      .rights_list_box_body {
        width: 95%;
        height: 100%;
        margin: 0 auto;
        padding-top: 20px;
      }
    }
  }
}
</style>
